package com.twu.biblioteca;

import java.util.Objects;

public class Book {

    private final String title;
    private boolean isReserved;

    public Book(String title) {
        this.title = title;
        this.isReserved = false;
    }

    public String getTitle() {
        return title;
    }

    public boolean isReserved() {
        return isReserved;
    }

    public void setIsReserved(boolean isReserved) {
        this.isReserved = isReserved;
    }

    @Override
    public String toString() {
        return title;
    }

    @Override
    public boolean equals(Object other) {
        return (this == other) ||
                ((other instanceof Book)
                        && Objects.equals(((Book) other).title, this.title));
    }

    @Override
    public int hashCode() {
        return Objects.hash(title);
    }
}
